// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.

using SixLabors.ImageSharp.Processing.Processors.Filters;

namespace SixLabors.ImageSharp.Processing;

/// <summary>
/// Defines extension methods that allow the application of black and white toning to an <see cref="Image"/>
/// using Mutate/Clone.
/// </summary>
public static class BlackWhiteExtensions
{
    /// <summary>
    /// Applies black and white toning to the image.
    /// </summary>
    /// <param name="source">The current image processing context.</param>
    /// <returns>The <see cref="IImageProcessingContext"/>.</returns>
    public static IImageProcessingContext BlackWhite(this IImageProcessingContext source)
        => source.ApplyProcessor(new BlackWhiteProcessor());

    /// <summary>
    /// Applies black and white toning to the image.
    /// </summary>
    /// <param name="source">The current image processing context.</param>
    /// <param name="rectangle">
    /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
    /// </param>
    /// <returns>The <see cref="IImageProcessingContext"/>.</returns>
    public static IImageProcessingContext BlackWhite(this IImageProcessingContext source, Rectangle rectangle)
        => source.ApplyProcessor(new BlackWhiteProcessor(), rectangle);
}
